{% extends 'base.html' %}

{% block content %}
<h1>{{ project }}</h1>
<ul>
{% if project.url %}
<li>Website: <a href="{{ project.url }}">{{ project.url }}</a></li>
{% endif %}
<li>Created by <a href="{{ project.creator.get_absolute_url }}">{{ project.creator.username }}</a> on {{ project.date_added|date:"F d, Y f A" }}</li>
</ul>
<h2>Project Description:</h2>
<p>{{ project.description }}</p>
<div id="issues">
<h2><a href="{% url issue_list project.slug %}">Issues</a></h2>
{% if project.issues.count %}
<ul>
{% for issue in project.issues.all %}
  <li><a href="{{ issue.get_absolute_url }}">{{ issue }}</a></li>
{% endfor %}
</ul>
{% else %}
<p>This project has no open issues.</p>
{% endif %}

</div>

<div id="milestones">
<h2><a href="{% url milestone_list project.slug %}">Milestones</a></h2>
{% if project.milestone_set.all %}
<ul>
{% for milestone in project.milestone_set.all %}
  <li><a href="{{ milestone.get_absolute_url }}">{{ milestone }}</a></li>
{% endfor %}
</ul>
{% else %}
<p>There are no pending milestones at this time.</p>
{% endif %}
</div>

<div id="timeline">
<h2><a href="{% url timeline_list project.slug %}">Timeline</a></h2>
{% for event in project.timeline_set.all %}
<p>{{ event.description }} <a href="{{ event.content_object.get_absolute_url }}">{{ event.content_object }}</a> on {{ event.date|date:"D M d Y" }} at {{ event.date|date:"P" }}</p>
{% endfor %}
</div>

<div id="members">
<h2><a href="{% url member_list project.slug %}">Project Members</a></h2>
{% if project.members.count %}
<ul>
{% for member in project.members.all %}
<li><a href="{{ member.get_absolute_url }}">{{ member.username }}</a></li>
{% endfor %}
</ul>
{% else %}
<p>This project has no members</p>
{% endif %}

</div>
{% endblock content %}